﻿@using X.PagedList;
@using OA.Model;
@using OA.Core.Helper;
@using OA.Model.View;
@{
    ViewBag.Title = "部门工作日志导出";
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
    List<VEmployeeInfo> employees = ViewBag.Employees;
    var list = employees.GroupBy(m => m.Level).ToList();
    string startTime = ViewBag.StartTime;
    string endTime = ViewBag.EndTime;
}
<div class="layui-my-content" style="padding-top:20px;">
    @using (Html.BeginForm(FormMethod.Post, htmlAttributes: new { @class = "layui-form" }))
    {
        @Html.AntiForgeryToken()
        <div class="layui-form-item">
            <label class="layui-form-label">开始时间：</label>
            <div class="layui-input-inline">
                <input type="text" name="startTime" class="layui-input mydate" id="startTime" placeholder="开始时间" value="@startTime" autocomplete="off" data-format="yyyy-MM-dd">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结束时间：</label>
            <div class="layui-input-inline">
                <input type="text" name="endTime" class="layui-input mydate" id="endTime" placeholder="结束时间" value="@endTime" autocomplete="off" data-format="yyyy-MM-dd">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">成员选择</label>
            <div class="layui-input-block">
                <div class="layui-collapse">

                    @foreach (var item in list)
                    {
                        <div class="layui-colla-item">
                            <h2 class="layui-colla-title">@item.Key</h2>
                            <div class="layui-colla-content layui-show">
                                @foreach (var employee in item)
                                {
                                    <input type="checkbox" name="empIDs" value="@employee.EmpID" lay-skin="primary" lay-verify="EmpID" class="mycode" title="@employee.EmpName" />
                                }
                            </div>
                        </div>
                    }

                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block" style="text-align:right;">
                <button class="layui-btn" lay-submit="">导出</button>
            </div>
        </div>
    }
</div>

<script type="text/javascript">
    layui.use([ 'element', 'form'], function () {
        var form = layui.form;
        form.verify({
            EmpID: function (value, item) {
                if ($("input[name='empIDs']:checked").length == 0) {
                    return '请至少选择一名成员';
                }
            },
        });
    });
</script>